<% if source_files.any? %>
  <table class="table table-striped" role="presentation">
    <% source_files.each do |file| %>
      <tr>
        <td>
          <span class="preview">
            <%= link_to file.full_url, title: file.file_name, download: file.file_name do %>
              <img src="<%= file.full_url %>" />
            <% end %>
          </span>
        </td>

        <td>
          <span>
            <%= link_to file.file_name, file.full_url, title: file.file_name, download: file.file_name %>
            - <%= number_to_human_size(file.file_size) %>
            <br />
            <textarea value="" disabled>![<%= file.file_name %>](<%= file.full_url %>)</textarea>
          </span>
        </td>

        <td>
          <button type="button" class="btn btn-info btn-sm select-gallery-image" data-dismiss="modal" data-url="<%= file.full_url %>">
            Select
          </button>

          <%= button_to admin_source_file_path(file, format: :json), { method: :delete, class: "btn btn-danger btn-sm delete", form_class: "delete", data: { confirm: "Are you sure?" } } do %>
              <i class="glyphicon glyphicon-trash"></i> <span>Delete</span>
          <% end %>
        </td>
      </tr>
    <% end %>
  </table>
<% else %>
  No images match this search
<% end %>
